SFC 1.0: A quick walkthrough
Facebook recently made a breaking change to the developer process, which makes it impossible for new applications to get the correct API keys. Since this essentially broke all previous versions of SFC, I went ahead and pushed the beta version public. It’s still unfinished, but Facebook didn’t really give me a lot of choice.
So, this is a quick walkthrough of some of the new features of SFC 1.0.
Upgrade Process
The upgrade process is slightly more involved for this one. It is recommended that you deactivate the old SFC plugins before upgrading. Why? Well, if you don’t, you’ll get a bunch of errors when visiting the Plugins screen later, saying that all the old SFC plugins either don’t exist or have an invalid header. These errors are normal, because of the next feature:
No more sub-plugins
Simple Facebook Connect is now a single plugin, with modular features. If you examine the plugins screen, you’ll find only one entry: Simple Facebook Connect.
The many-plugins-in-one was a useful experiment, IMO, and I still think it’s a better way to do things. But many people find it confusing, and some have disagreed with the notion. A lack of useful core support for plugin dependencies and user feedback convinced me to switch it up. So now, SFC is one plugin. But it’s still modular!
As you can see in the image, you can still turn on and off pieces of the plugin. Why have a piece running and consuming valuable resources if you’re not using it? Turning a module off completely disables it in the code. And the core of SFC itself is still written modularly, for maximum performance (since integrating Facebook itself is such a drag on performance for a site to begin with).
Support for new Facebook code
Over a year ago, Facebook stopped supporting the original Facebook Connect libraries. This was a major problem for sites, however the old code still worked. So as time went on, and the old Connect libraries started to degrade and become less and less useful, SFC was rewritten from the ground up to use all the newer supported libraries. Facebook’s JS SDK is used. FB’s Graph API is used. The old Facebook REST Platform code is completely gone, as are the older incompatible Facebook Connect libraries. OpenGraph meta tags (including embed info for images and video) are inserted into the entire site, completely automatically, allowing Facebook to see the content of your site and act accordingly.
Many of the plugins themselves have been rewritten fairly extensively as well, but with this comes some removal of older code.
The Share button is gone. It was previously implemented using the older Connect libraries, but with the newer libraries from Facebook, it’s been completely removed. There was just no good way to retain it, Facebook has simply dropped any and all support for it. So, in it’s place (because it was so handy) is a modified Like button, which can still look sorta like the old Share button. The SFC module is still named Share, for ease of transition. The Like button itself is still around too, so you can use both Like and Share to get two Like buttons on the same post, perhaps for different placement.
The Bookmark widget is gone. It simply isn’t supported anymore, and didn’t work anyway.
The Find on Facebook widget is gone. This didn’t do really anything special to begin with, other than place the Find Us image into a widget, with a link to the Facebook Page. The image it once used is still included in the plugin, for people that want to do this themselves via a text widget.
The Connect widget is gone, but may make a return in the next version, as soon as some bugs are sorted out.
The Upcoming Events widget is gone. It rarely worked properly to begin with, and the newer XFBML libraries doesn’t have support for it anymore. A alternate approach to this may make it back into the next version.
All the remaining widgets have been combined into a single module for use on the widgets screen. In addition, most of them still have a way to access them directly, such as from a function call in a theme.
The Publisher has been simplified greatly. For one, auto-publishing now works even for Applications! The confusing permissions dialogs have been reduced to one. Colored indicators have been added, showing when the plugin has the necessary “tokens” from Facebook in order to be able to publish properly. The manual publishing functionality is still on the edit post screens too. And for those people using the auto-publish, a new system for pulling Facebook comments on their published posts back into the blog has been implemented.
For those who wanted it, Custom Post Type support has been added to the publisher as well. Any CPT marked as “public” gets shared like everything else.
The Register system has been completely rewritten to take advantage of Facebook’s new register plugin functionality. It can handle standalone registrations, or registrations using Facebook information. It even adds a Facebook created captcha to prevent spam registrations.
Login has been improved. One of the most common complaints was “What does ‘User not recognized’ mean?” This should be severely reduced now, since the Login module will auto-detect existing users and automatically connect their local WP accounts with their FB accounts, when they try to login. This follows Facebook’s own Registration Flow Models for connecting users to sites.
The Comment system has been improved. The share-after-comment system now happens in the background, no extra popups for users to have to click on. The whole system is now using the Graph API, so no more strange javascript errors causing weirdness. Although there is still some javascript to display the user their picture and info after logging in, so it still has that same look and feel.
There’s a lot more too. I’ll be updating this post with new stuff soon!
I think you could have left the original plugin files in tact and had them automagically deactivate themselves. That would avoid the errors appearing on upgrading (without deactivating first).
Probably, and if FB hadn’t suddenly broke the old one without any warning, I would have added that before releasing, but whatever. It works regardless, even if the upgrade process is a bit spotty. If you deactivate the old plugins first like the upgrade notice tells you to, it has no problems.
Hello, I have read that FB was going to require SSL for some stuff and that this will affect SFC? Is that anything to do with what forced your latest release or something else?
The new version of the plugin uses https connections throughout and will work fine with SSL.
The reason for the release was that they changed their old developers site to redirect to the new one, and the new one doesn’t display the old API key, which the previous versions of SFC required to function. The new code no longer requires the API key.
Sorry to be so late in coming back on this. I don’t really understand all this SSL stuff but I had read that FB were moving towards a position where you would not be able to use their API without a SSL? I think that I read it on John Eckman’s blog in relation to WPbook.
Thanks
They have already done that. The Graph API requires HTTPS for any connection that uses an access token. SFC 1.0 uses HTTPS to talk to Facebook throughout.
Since the Connect Widget is gone how do I go about placing a SFC login button in my theme? My old theme is currently broken. Thanks, love this plugin!
You can place this code into your theme or a text widget or something to put a Login button anywhere you like:
You need to replace the URL there with the URL to your wp-login.php file. This is so WordPress can pick up on the login and log you in properly.
Alternative if you want them to be redirected back to the main page after logging in:
Please take a look at this http://faixamobi.com/2011/08/24/symbian-belle-e-lancado-oficialmente-e-desperta-a-atencao-do-mundo/
After the update, the login button using the facebook account is not being shown.
Actually, it´s being displayed only the message “Connect with facebook”, but there is no button.
oopps.. Sorry! Only now I saw that this widget is gone…
Hello :D! I updated the plugin and I have an problem with the comments u.u After the update, the button for connect with facebook to comment isn’t there, in the place where it be display only appears this text: “Connect with Facebook”. Can you help me u.u?
Oh, emm, sorry about the last question >.<! I just saw the other entry, and thanks ;D!
@ottodestruct there seems to be a conflict between SFC 1.0 and Mingle Forum 1.031 @cartpauj
After upgrading works nothing – sidebar widgets, not clickable text instead of button Grant SFC permissions in control panel etc. Also clean install on similar environment gives the same.
Is there something wrong in facebook app. settings, permissions…?
No, nothing’s wrong with the plugin. It all works properly.
yeahh, I found this. The evil is localised wordpress. After changing wp-config.php
to
I got Facebook buttons… and WordPress in english.:( Probably, Carlos and aldon can try this.
A WPLANG of “lv” isn’t a valid locale value anyway. You should be using “lv_LV” for that variable. Then you’d find that the Facebook stuff would translate as well.
The Facebook code does have locale support, you just have to use the standard recognized locales.
Thank you and beer from me! 🙂
There’s a problem with locales… Catalan locale, for example, is “ca” in WordPress (so it is in wp-config.php), but is ca_ES in Facebook. Because of that, Facebook messages are in English.
Is there any workaround?
I’ve hardcoded
if($locale == 'ca') $locale = 'ca_ES';
in the plugin, but there should be a better approach 😉You should be using ca_ES as the locale in WordPress as well. This is just a matter of naming the mo files you’re using to not be “ca” but to be “ca_ES” and then setting the locale properly.
Locales should always be the language and country, not just the language.
The issue here is that “ca” is a correct locale. Both country and variant (like, for example, in Catalan, ca_ES-valencia) are optional, and the only required part is tha language: language[_COUNTRY][-variant].
In the case of Catalan, because it’s spoken in 4 countries (ES, AD, FR, IT), but there’s only one translation in WordPress, “ca”, which is the one.
Here you have a list of WordPress locales http://svn.automattic.com/wordpress-i18n/ I’m sure you know how to get it, but just wanted to make things easier.
Also, I’ll try to send you a patch to “match” WordPress to Facebook locales (if you don’t mind)
I doubt I’d put such a patch into SFC. It would be better to switch the language naming scheme to be standardized to a specific format, like FB has done.
It’s standarized, according to
http://www.gnu.org/s/hello/manual/gettext/Locale-Names.html
And Catalan is not the only language affected by this. Other languages like ‘li’, ‘lv’, ‘nl’,… (WordPress supported locales) won’t be able to load correct locale file
That page agrees with me and says locale names should usually take the form of ll_CC.
If you want to complain to Facebook and have them support the “standard” as you see it, then that’s fine. But I’m not putting in some kind of conversion chart to convert locales like that.
I would consider putting in a definable override like SFC_LOCALE or something, so that you could define your Facebook locale for use by the plugin though.
I agree with you that usually they have the country code, but sadly it’s not the case for a lot of WordPress (if the locale I use was lang_COUNTRY I’m sure I would never saw it).
What you say about the SFC_LOCALE would be a good idea too.
Anyway, I’ve almost finished the conversion array, and I’ll link here (if you don’t mind), so if anyone decides to use it, they can.
Anyway, thanks for your plugin! I hope you’ve seen the beer sent to Paypal 😉
I liked the SFC_LOCALE bit too, so I put it into trunk. Check out the new sfc-base.php file in trunk, which will let you override the locale with that define in your wp-config.php.
Great! Working 😉
Well, I tried a lot of things but the button “Connect with Facebook” still without works :c! I hope you can help me u.u this is my wordpress http://popcornlove.org I tried to get back the 0.25 version but I have troubles. Thanks a lot for you plugin ;D!
You have like half a dozen javascript errors on your pages caused by other plugins and such which are causing javascript to stop processing, which is why the Facebook javascript isn’t working.
Fix the page to not have all the problems, then things will work properly.
Oh, ok c: Thanks a lot :D!!
Otto can you check it?
with this plugin active http://grab.by/aMRY
the SFC doesn’t work http://grab.by/aMRZ
i use only the publish plugin to post the news to facebook page
(see here) http://grab.by/aMS0 Grant SFC Permissions button doesn’t load
Well, deactivate the other plugin which is causing the problem then. Seems pretty straightforward, really.
very strange
οn my demo site with exactly same plugins, settings etc the SFC works
on my primary site, the SFC doesn’t work
also please tell me how to delete absolute the plugin and re-install it.
if i deactivate and delete from plugins section on wordpress, and re-install it, the plugin has again the previous settings.
So, how i can delete 100% the SFC?
The plugin includes an uninstall.php file which will remove the single options setting that SFC uses. If you deactivate and delete from within WordPress itself, the option should be deleted. This will only work on single site installs though, multi-site installs don’t work in quite the same manner.
If you want to clear the option manually, it’s in the options table with a key of “sfc_options”. All of the plugin options are stored there.
However, removing it and reinstalling it won’t ever “fix” anything. If a setting is wrong, then just put in the correct value and Save. It has no memory. Reinstalling never fixes anything.
Is there something special you need todo to get the comments working?
I have tried on two sites now and I dont get them to display.
I have Integrate FB Comments (needs automatic publishing enabled)
And Autopublish enabled, and the Auto publish seems to work just fine.
However I see no comments.
Which “comments” are you referring to? The comments integration bit pulls back comments from Facebook auto-published posts and displays them on your own site. And it’s wholly automatic, there’s no configuration to set for it.
I have posted a comment here on my Facebook page, I thought it would show up on the site?
https://www.facebook.com/pages/Philip-Stridh-Photography/115861411776678
However I dont see it in the related post:
http://everymoment.se/2011/08/testar-lite
And the same for another site I tried it on.
You only posted it 23 minutes ago. So it’ll show up in about 6 hours or so. The plugin doesn’t check Facebook every single time. It caches results and only checks every 6 hours or so, because checking Facebook for comments is *slow*.
Aha, cool thanks. Also thanks for a GREAT plugin been using the old version for some time, and It might be time to get Otto some beers now 🙂
Its been a couple of days now, still dont see the comments.
any chance you will be inclduing qtranslate support soon? 🙂
Hi Otto,
I loved your original plugin, it was great! I am having some trouble with the update however. Now that I have updated, the “Connect with Facebook” comments module is not working.
If you press ‘connect with facebook’ it will retrieve your name and fb picture properly, but when you post the comment it logs the user as “Anonymous” instead of linking to their fb profile (and therefore, it does not push the comment to their profile either). However, it does show the fb profile picture. In my SFC settings, I am unable to retrieve “Application Access Token” for some reason, but “User ID and Access Token” is found fine. Is this causing the problem?
http://nickelfamily.com/terrah/?p=1665
You might have this sort of issue if your PHP doesn’t have OpenSSL support installed. Unfortunately, there’s no way to fix this other than to fix your PHP installation. Facebook now requires HTTPS connections, and the only way to do that from PHP is to have the OpenSSL support installed.
I checked with my hosting provider today and OpenSSL support is enabled:
OpenSSL support : enabled
OpenSSL Version : OpenSSL 0.9.8k 25 Mar 2009
For now I have disabled the ‘Connect with Facebook’ comments on my posts until I can figure this out. If you have any other ideas I would be very grateful!
In the previous version a user’s avatar and name would automatically show up under the Leave a Reply section after logging in and hitting ctrl+F5 (or browsing to another post. It would seem the user was logged in only once.
Now if I click the “Connect with Facebook” button and login, my avatar will show up. But hit ctrl+F5 and it’ll be gone and the “Connect with Facebook” button shows again.
If I remember correctly sfc_update_user_details was called after the FB.Init. Now it’s not even called during the page load. By design?
Hey Otto,
Everything is working *great* on my site using your plugin! However, one little annoyance that I’m sure is probably a limitation of Facebook or something. When pulling in Facebook comments, it doesn’t appear to actually add them to wordpress, so the comment count is off. Is this something that can be fixed?
The comments integration module actually does adjust the comment count properly, but this will only be visible on the single post pages where the comments are actually displayed. It doesn’t attempt to adjust the counts on the index or archive pages, because doing so would be much slower. It would have to load the comments for all the posts displayed and adjust counts properly, and this is problematic because comments aren’t normally loaded or displayed on those pages.
Just noticed this while commenting on your site as well… Every time you post a comment, it “unconnects” you, and you have to click connect with facebook again to comment. Although it does not ask for permission again. Just a slight annoyance.
It doesn’t actually unconnect you, as you noticed. It simply doesn’t remember you from last time. Again, this is a speed move. Connecting to FB to get your data again is slow, so I optimized this away. If the person isn’t going to bother to leave a comment, there’s no reason to slow down page display by retrieving the data from Facebook again.
Thank you for the quick reply, and sorry for the trouble! Just didn’t see the expected behavior. Makes sense now, I suppose.
This plugin is awesome.
Upgrade was succefull and everything is much better, clearer and easy to set.
Only thing I noticed in my site is that the fb registration box is loading twice.
Any thoughts?
Thanks in advance.
Happy to see the update. I am going to try later of today. Hope this can still work with my theme.
Nice update!
I have a weird problem though… When it’s in posts the SFC button is working OK, but not when it’s in pages.
See for example a post: http://www.freeweird.com/2010/08/move-blog-blogger-wordpress.html
and a page: http://www.freeweird.com/askus
Any ideas about why this thing happens?
Thanks!
Great work Otto! Love the new unified plugin structure. Keep up the good work!
Cheers,
Graham
hi otto…
great update… just a few little problems.
the og:description is grabbing “Related Posts:” any idea how i can stop this?
(have a look at the source-code from on of your shorter posts, if you don’t know what i mean view-source:http://ottopress.com/2010/simple-facebook-connect-activity-feed-widget/)
i found how to stop it from using og:video wich shows embeds on facebook with a play-button, but somehow links to embeds that are not working by uncommenting the if
(!empty($video))
in sfc-base.php though.. 🙂sascha
found it… 🙂 nothing a little explode at the right place can’t fix.
Hello Otto,
Just wondering if it is possible for the Facebook auto-publish feature to only post the text before the more tag? I am willing to make the edit on my own files if you could point me in the right direction. This would also make a good feature or option for future releases!
Thank you,
Joe
Hello Otto,
i’m using your plugin, but i’ve some questions:
1. Where i can find full documentation about the manual insertion of the Likebox and the other plugins?
2. I’m happy in 1.0 version you added Opengraph. But i’d love using the Opengraph tags generated by the SEO plugin, so i suggest you a flag to enable or disable it in a next version.
3. If possible, i’d like to change the default og:type tag with many others supported by FB
Can you help me, pls, telling me how can i remove the Opengraph tags (or part of them) in the 1.0 SFC code?
Thank you 🙂
Hi Otto,
Thanks for the upgrade and for all your work with this plugin!
After I upgraded, I seem to have lost all my likes…?
Is there a way of fixing this? Website is http://lifewithoutcameron.com
Thanks,
Ronnie
Very Impressed. Just included SFC in one blog and everything went smoothly. I’ll be adding this to others over the next week. Great plugin and would love to see it include G+ if that’s possible.
Dex…
The plugin works great on several sites for me. Finally remembered to send a couple beers when I actually had loot in my account. Thanks for the efforts Otto!
[…] http://ottopress.com/2011/sfc-1-0-a-quick-walkthrough/ […]
Just installed this and it seems to be working very well. Pulling cooments made on Facebook back to my blog.
And is this plugin able to pull LIKES made on Facebook back to the blog post too? I do not see that happening but not sure if it is supposed to (or even possible.)
Comments made on Facebook do not show up in the RECENT COMMENTS widget. Does this mean that they would not be flagged if somebody was SUBSCRIBING to the comments of that post?
I see that these comments are not editable. Where exactly are they stored?
The comments it pulls back from Facebook are not real comments and they won’t show up to anything else as if they were real comments.
This is intentional. One of the problems with pulling back comments is synchronization and fitting into Facebook’s terms of use.
Firstly, synchronizing comments from FB back into the comments table is possible, but a bit on the slow side. And even if you do pull them in and make them into “real” comments on the post, there’s a serious question about replies. When somebody replies to one of those comments, the person being replied to has no way to see it or know that a reply has been made. The reply can’t be posted back to Facebook in any kind of meaningful way. Subscription plugins won’t work, because FB doesn’t give back a valid email to associate with the comment (nor should it, really).
Secondly, there’s the Facebook developers policy. Basically, it says while caching data is fine, you don’t own the data and can’t really store it for any length of time. This ties in with the idea of “what if somebody deletes their FB comment”? How do you synchronize that deletion?
So, bottom line is that I made it such that it makes a best-effort to get these comments, and it fiddles with the comments loop so as to make them look like comments to the comments display mechanism. But they’re not real comments in the WordPress database. They don’t trigger subscription notifications. They don’t show up as recent comments. They don’t show up as comments in the wp-admin area. They’re just a fun way, displayed on the single post page only, to see stuff being said about a post elsewhere.
FB Comments are not “real” comments in any meaningful way. They’re ways to trigger discussion on your page and to show interaction of your post happening elsewhere, by displaying the comments from Facebook inline. But that’s all.
Thanks so much for that speedy and thorough reply! I see what you mean. I am still curious though as to where these comments exist? Are they not anywhere in my database at all? (That is just simple curiosity as to how the trick of it is achieved!)
And the only other thing I wonder about is the LIKES made on the post on Facebook. Are they supposed to be brought over to my blog post too?
Thanks again!
They’re stored in transients. Which can either be stored in the DB or in an external memory cache, if you’re using one.
And no, likes can’t migrate. Doesn’t work that way.
Ok, thanks!
Oh, I just remembered another question or two: the RECOMMENDATIONS option is working beautifully but the RECENT ACTIVITY feed only seemed to work for a moment or two. Not sure if I changed a setting to stop that or what. maybe an issue with how I set up the FB application.
The other question is this: I have visited other blogs where my FB avatar automatically appears in the comment field, letting me know that I can post under my FB identity. Is that something I can make happen here too! I notice there is text to let me know I am signed in. Would adding an image be done by fiddling with the code on my blog? Thanks in advance for any tips.
Hello Otto! Great plugin. Good luck 😛
But have a problem: This plugin is not compatible completely with the new Mystique theme. Please, update wp-signup.php modified page by Mystique.
And how can add a “login with facebook” widget in my page?
Thank You
Hi Otto,
I posted earlier that I was having trouble with the update – I wanted to let you know that with the new update this morning everything is working great again. Whatever was changed solved the problem.
Thanks again for all your great work.
Terrah
The issue fixed was an issue that happened on some hosting providers that don’t have the latest SSL certificate authority lists. Version 1.1 turns off CA verification to eliminate the error.
Does not integrate with Qtranslate. Any future plans for this?
Not specifically. QTranslate does weird stuff strangely.
You can try the latest trunk version. I put some changes in there that might help matters, but I won’t be adding specific support for other plugins.
Thanks Otto, will give it a try this very afternoon. And apologies for having been so vague. In fact, your plugin does get along well with QTRANSLATE, except when passing the post’s title string to FB. The link to the post (URL) is correct, however the link text is not (it displays the title in all available languages rather than the one the WordPress is displaying at that moment).
Anyway, I will get back with more info after giving the trunk version a try. Thanks again.
Here is the update, the trunk version does not present the issue, so it is possible now to post to FB from within WP, having the link text displayed correctly in FB. This is good news!
However please note that if WordPress has its dashboard set to a language different from the default (spanish in our case) and one tries to publish to FB a WordPress post then it fails (the Facebook preview box displays an error).
If you would like me to keep trying different scenarios with WordPress + SFC + Qtranslate just let me know!
Hi, how can a EDITOR user click on the Grant SFC Permissons buttom to enable the automatic publish to pages token, if they cannot access to the Settings menu un the admin panel.
I’ll be waiting for your answer! Thank you very much!
They can’t. An Admin has to set up the plugin.